package com.ruoyi.system.service.impl;

import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.system.domain.ResourceTable;
import com.ruoyi.system.mapper.ResourceTableMapper;
import com.ruoyi.system.service.IResourceTableService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 资源Service业务层处理
 * 
 * @author ruoyi
 * @date 2024-04-18
 */
@Service
public class ResourceTableServiceImpl implements IResourceTableService 
{
    @Autowired
    private ResourceTableMapper resourceTableMapper;

    /**
     * 查询资源
     * 
     * @param resourceId 资源主键
     * @return 资源
     */
    @Override
    public ResourceTable selectResourceTableByResourceId(Long resourceId)
    {
        return resourceTableMapper.selectResourceTableByResourceId(resourceId);
    }

    /**
     * 查询资源列表
     * 
     * @param resourceTable 资源
     * @return 资源
     */
    @Override
    public List<ResourceTable> selectResourceTableList(ResourceTable resourceTable)
    {
        return resourceTableMapper.selectResourceTableList(resourceTable);
    }

    /**
     * 新增资源
     * 
     * @param resourceTable 资源
     * @return 结果
     */
    @Override
    public int insertResourceTable(ResourceTable resourceTable)
    {
        resourceTable.setCreateTime(DateUtils.getNowDate());
        return resourceTableMapper.insertResourceTable(resourceTable);
    }

    /**
     * 修改资源
     * 
     * @param resourceTable 资源
     * @return 结果
     */
    @Override
    public int updateResourceTable(ResourceTable resourceTable)
    {
        resourceTable.setUpdateTime(DateUtils.getNowDate());
        return resourceTableMapper.updateResourceTable(resourceTable);
    }

    /**
     * 批量删除资源
     * 
     * @param resourceIds 需要删除的资源主键
     * @return 结果
     */
    @Override
    public int deleteResourceTableByResourceIds(Long[] resourceIds)
    {
        return resourceTableMapper.deleteResourceTableByResourceIds(resourceIds);
    }

    /**
     * 删除资源信息
     * 
     * @param resourceId 资源主键
     * @return 结果
     */
    @Override
    public int deleteResourceTableByResourceId(Long resourceId)
    {
        return resourceTableMapper.deleteResourceTableByResourceId(resourceId);
    }
}
